Conversation
Signed-off-by: siri-varma <siri.varma@outlook.com>
|
@artur-ciocanu / @cicoyle / @javier-aliaga / @salaboy Please take a look at this PR when you get a chance. Thanks |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1659 +/- ##
============================================
+ Coverage 79.51% 79.54% +0.02%
- Complexity 2194 2196 +2
============================================
Files 237 238 +1
Lines 6577 6591 +14
Branches 730 732 +2
============================================
+ Hits 5230 5243 +13
+ Misses 992 990 -2
- Partials 355 358 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@siri-varma I ask copilot to review, lets see what it suggest, I will do my own review tomorrow |
There was a problem hiding this comment.
Pull request overview
Adds W3C baggage propagation support to the Dapr Java SDK so that baggage can flow through both gRPC and HTTP calls via Reactor context, and includes a new example + gRPC-focused tests.
Changes:
- Add
Headers.BAGGAGEconstant and propagate it through HTTP header allowlist. - Introduce
DaprBaggageInterceptorand wire it into the gRPC interceptor chain. - Add a baggage example and a new gRPC unit test suite validating propagation behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/src/test/java/io/dapr/client/DaprClientGrpcBaggageTest.java | New gRPC tests validating baggage propagation behavior. |
| sdk/src/main/java/io/dapr/internal/grpc/interceptors/DaprBaggageInterceptor.java | New gRPC client interceptor injecting baggage into metadata from Reactor context. |
| sdk/src/main/java/io/dapr/internal/grpc/DaprClientGrpcInterceptors.java | Wires the new baggage interceptor into the existing interceptor chain. |
| sdk/src/main/java/io/dapr/client/Headers.java | Adds a public BAGGAGE header constant. |
| sdk/src/main/java/io/dapr/client/DaprHttp.java | Allows baggage to be promoted from Reactor context into outgoing HTTP headers. |
| examples/src/main/java/io/dapr/examples/baggage/README.md | New documentation for the baggage example. |
| examples/src/main/java/io/dapr/examples/baggage/BaggageClient.java | New runnable example demonstrating baggage propagation via Reactor context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @AfterEach | ||
| public void tearDown() { | ||
| } |
There was a problem hiding this comment.
This @AfterEach method is empty, so it adds noise without providing cleanup. Consider removing it or using it to clean up resources created in setupServer (for example, shutting down the ManagedChannel if not handled by GrpcCleanupRule).
| Mono<Void> result = invoke() | ||
| .contextWrite(it -> it.putAll((ContextView) context)); | ||
| result.block(); |
There was a problem hiding this comment.
The cast to ContextView is unnecessary here since Reactor's Context already implements ContextView. Using putAll(context) directly avoids the cast and matches existing patterns in other tests.
| Mono<Void> result = invoke() | ||
| .contextWrite(it -> it.putAll((ContextView) context)); | ||
| result.block(); |
There was a problem hiding this comment.
The cast to ContextView is unnecessary here since Reactor's Context already implements ContextView. Using putAll(context) directly avoids the cast and matches existing patterns in other tests.
| Mono<Void> result = invoke() | ||
| .contextWrite(it -> it.putAll((ContextView) context)); | ||
| result.block(); |
There was a problem hiding this comment.
The cast to ContextView is unnecessary here since Reactor's Context already implements ContextView. Using putAll(context) directly avoids the cast and matches existing patterns in other tests.
| Mono<Void> result = invoke() | ||
| .contextWrite(it -> it.putAll((ContextView) context)); | ||
| result.block(); |
There was a problem hiding this comment.
The cast to ContextView is unnecessary here since Reactor's Context already implements ContextView. Using putAll(context) directly avoids the cast and matches existing patterns in other tests.
| private static final Set<String> ALLOWED_CONTEXT_IN_HEADERS = | ||
| Set.of("grpc-trace-bin", "traceparent", "tracestate", "baggage"); |
There was a problem hiding this comment.
This adds baggage to the context-to-header allowlist, but there isn't a corresponding HTTP test asserting the header is actually propagated. Consider extending the existing invokeServiceWithContext test (or adding a new one) to put Headers.BAGGAGE in the Reactor context and assert the outgoing HttpRequest contains the baggage header.
| import io.dapr.client.DaprClientBuilder; | ||
| import io.dapr.client.Headers; | ||
| import io.dapr.client.domain.HttpExtension; | ||
| import io.dapr.utils.TypeRef; |
There was a problem hiding this comment.
Unused import io.dapr.utils.TypeRef is present but not referenced in this example. Please remove it to keep the example compiling cleanly under stricter build/lint configurations.
| import io.dapr.utils.TypeRef; |
| .addService(service) | ||
| .build().start()); | ||
|
|
||
| ManagedChannel channel = InProcessChannelBuilder.forName(serverName).directExecutor().build(); |
There was a problem hiding this comment.
ManagedChannel created for the in-process server isn't registered with GrpcCleanupRule (and isn't otherwise shut down). This can leak threads/resources across tests; register the channel with grpcCleanup or explicitly shutdown it in an @AfterEach hook.
| ManagedChannel channel = InProcessChannelBuilder.forName(serverName).directExecutor().build(); | |
| ManagedChannel channel = grpcCleanup.register( | |
| InProcessChannelBuilder.forName(serverName).directExecutor().build()); |
|
@copilot can you fix the comments ? |
Description
Please explain the changes you've made
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: